package com.bit.java1;

import java.util.Arrays;

public class Test2 {

    public static void swap(int[] array, int left, int  right) {
        int ret = array[left];
        array[left] = array[right];
        array[right] = ret;
    }

    public static void swapDidital(int[] array) {
        int left = 1;
        int right = 0;
        if(array.length % 2 == 0) {
            right = array.length - 2;
        } else {
            right = array.length - 1;
        }
        while(left < right) {
            swap(array,left,right);
            left += 2;
            right -= 2;
        }
        System.out.println(Arrays.toString(array));
    }

    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
        swapDidital(array);
    }


}
